Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cet: update map_shadow_stack syscall number due to kernel code update #112

Merged
merged 1 commit into from
Sep 6, 2023

Conversation

xupengfe
Copy link
Contributor

@xupengfe xupengfe commented Sep 6, 2023

User space SHSTK has been merged into Linux kernel main line: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=df57721f9a63e8a1fb9b9b2e70de4aa4c7e0cd2e

SHSTK syscall map_shadow_stack number is 453(not 451 or 452) in Linux mainline kernel:
https://github.com/torvalds/linux/blob/0468be89b3fa5b9249cee1097f1d50314950a2df/arch/x86/entry/syscalls/syscall_64.tbl#L377 All test kernel will follow the main line kernel, so update map_shadow_stack to 453 for future kernel tests.

User space SHSTK has been merged into Linux kernel main line:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=df57721f9a63e8a1fb9b9b2e70de4aa4c7e0cd2e

SHSTK syscall map_shadow_stack number is 453(not 451 or 452) in Linux mainline
kernel:
https://github.com/torvalds/linux/blob/0468be89b3fa5b9249cee1097f1d50314950a2df/arch/x86/entry/syscalls/syscall_64.tbl#L377
All test kernel will follow the main line kernel, so update map_shadow_stack
to 453 for future kernel tests.

Signed-off-by: Pengfei Xu <[email protected]>
@xupengfe
Copy link
Contributor Author

xupengfe commented Sep 6, 2023

The 3 warnings are as expected, please ignore:
"
#61: FILE: /root/test_shadow_stack.c:61:
+#define ARCH_SHSTK_WRSS (1ULL << 1)

WARNING: Prefer __always_inline over attribute((always_inline))
#84: FILE: /root/test_shadow_stack.c:84:
+static inline unsigned long attribute((always_inline)) get_ssp(void)

WARNING: Use of volatile is usually wrong: see Documentation/process/volatile-considered-harmful.rst
#206: FILE: /root/test_shadow_stack.c:206:
+volatile bool segv_triggered;

WARNING: Prefer noinline over attribute((noinline))
#209: FILE: /root/test_shadow_stack.c:209:
+void attribute((noinline)) violate_ss(void)
"
Thanks!

@xupengfe
Copy link
Contributor Author

xupengfe commented Sep 6, 2023

/* It's a test code not kernel code and it can't use always_inline. */
static inline unsigned long attribute((always_inline)) get_ssp(void)

/* The volatile is necessary for the tests. */
volatile bool segv_triggered;

/* It's a test code not kernel code and it can't use noinline. */
void attribute((noinline)) violate_ss(void)

@ysun
Copy link
Contributor

ysun commented Sep 6, 2023

Thanks Pengfei's explaination. The patch looks good to me.

@ysun ysun marked this pull request as ready for review September 6, 2023 05:54
@ysun ysun merged commit bc65df6 into intel:main Sep 6, 2023
1 of 2 checks passed
@xupengfe
Copy link
Contributor Author

xupengfe commented Sep 6, 2023

Thanks Sun Yi's review!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants